{% extends "base.html" %}
{% from "dashboards/includes/macros.html" import localization_sidebar_nav %}
{% from "dashboards/includes/macros.html" import product_choice_list with context %}
{% set title = _('Aggregated Localization Metrics') %}
{% set scripts = ('wiki', 'jqueryui', 'rickshaw', 'wiki.dashboard') %}
{% set styles = ('rickshaw', 'kbdashboards') %}
{% set crumbs = [(None, title)] %}
{% set classes = 'aggregated-metrics' %}

{% set product_slug = product.slug if product else 'null' %}


{% block content %}
  <div class="grid_9">
    <article class="dashboards">
      <h1>{{ title }}</h1>

      {{ product_choice_list(products, product, url('dashboards.aggregated_metrics')) }}

      <div class="loading-data">
        {{ _('The dashboard data is being loaded. This may take some time.') }}
      </div>

      <div id="dashboard-readouts">
        <section id="percent-localized-top100" data-url="{{ url('api.wikimetric_list')|urlparams(product=product_slug, page_size=1000) }}">
          {# Double % required below to escape % for gettext #}
          <h2>{{ _('Top 100 Articles: %% Localized') }}</h2>
          <div class="rickshaw">
            <div class="inline-controls"></div>
            <div class="graph-container">
              <div class="slider"></div>
              <div class="graph"></div>
            </div>
          </div>
        </section>

        <section id="percent-localized-top20" data-url="{{ url('api.wikimetric_list')|urlparams(product=product_slug, page_size=1000) }}">
          {# Double % required below to escape % for gettext #}
          <h2>{{ _('Top 20 Articles: %% Localized') }}</h2>
          <div class="rickshaw">
            <div class="inline-controls"></div>
            <div class="graph-container">
              <div class="slider"></div>
              <div class="graph"></div>
            </div>
          </div>
        </section>

        <section id="percent-localized-all" data-url="{{ url('api.wikimetric_list')|urlparams(product=product_slug, page_size=1000) }}">
          {# Double % required below to escape % for gettext #}
          <h2>{{ _('All Articles: %% Localized') }}</h2>
          <div class="rickshaw">
            <div class="inline-controls"></div>
            <div class="graph-container">
              <div class="slider"></div>
              <div class="graph"></div>
            </div>
          </div>
        </section>

        <section id="active-contributors" data-url="{{ url('api.wikimetric_list')|urlparams(product=product_slug, page_size=1000) }}">
          <h2>{{ _('Active Contributors') }}</h2>
          <div class="rickshaw">
            <div class="inline-controls"></div>
            <div class="graph-container">
              <div class="slider"></div>
              <div class="graph"></div>
            </div>
          </div>
        </section>
      </div>
    </article>
  </div>
{% endblock %}

{% block side_top %}
  {{ localization_sidebar_nav(request.LANGUAGE_CODE, 'aggregated', current_locale==settings.WIKI_DEFAULT_LANGUAGE) }}
  <section id="locale-picker" class="cf" data-locales="{{ locales_json }}">
    <ul>
      {% for locale in locales %}
        <li>
          <label title="{{ _('{count} visitors in the past 30 days')|f(count=locale[1]) }}">
            <input type="checkbox" name="locale" value="{{ locale[0] }}" />
            {{ locale[0] }}
          </label>
        </li>
      {% endfor %}
    </ul>
  </section>
{% endblock %}
